package com.gonsin.gnews.service;

import com.gonsin.gnews.annotations.model.NewsTemplateBean;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class NewsCache {

    private Map<String, Object> cache = new ConcurrentHashMap<>();

    public List<NewsTemplateBean> get(String key) {
        return (List<NewsTemplateBean>) cache.get(key);
    }

    public void put(String key, List<NewsTemplateBean> list) {
        cache.put(key, list);
    }

    public void evict(String key) {
        cache.remove(key);
    }
}
